<?php

require_once('include/include_base.php');


if (isset($_GET) && !Validation::isEmptyString($_GET['action'])) {
	if ($_GET['action'] == 'search') {
		
		// get Topics by title
		$topicVO = new TopicVO();
		$topicVO->name = $_GET['q'];
		$topic = new Topic($topicVO);
		$topicsTemp = $topic->getTopicsByNameSearch();
		foreach($topicsTemp as $topicVO) {
			$topicVO->linkifyDescription();
			$topicVO->highlight($_GET['q']);
			$topics[] = $topicVO;
		}
		
	}
	
}

$smarty->assign("q", $_GET['q']);
$smarty->assign("topics", $topics);

$smarty->assign("page", "search");
$smarty->display('master.tpl.html');